package net.siufung.market.base.dept.controller.regulation;

import lombok.AllArgsConstructor;
import net.siufung.core.exception.BizServiceException;
import net.siufung.core.model.regulation.AbstractRegulation;
import net.siufung.market.base.dept.mapper.IDeptMapper;

import java.util.Objects;

/**
 * @author 陈建峰
 * @since 2022/7/31 10:50 下午
 */
@AllArgsConstructor
public class DeptStatusRegulation extends AbstractRegulation<String> {

    private static final long serialVersionUID = 1431879324533343046L;

    private final IDeptMapper deptMapper;

    @Override
    public boolean isSatisfiedBy(String id) {
        if(Objects.isNull(deptMapper.selectById(id))){
            throw new BizServiceException("当前部门不存在！");
        }
        return Boolean.TRUE;
    }
}
